<%@ page language="java" contentType="text/html; charset=EUC-KR"
	pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body><%@ page import = "java.sql.*, java.util.*" %>
<%

String jdbcUrl = "jdbc:mysql://localhost/theater?useUnicode=true&characterEncoding=EUC_KR";;
String dbUser = "root";
String dbPass = "apmsetup";


request.setCharacterEncoding("EUC-KR");

String MovieID = request.getParameter("MovieID");
String M_Name = request.getParameter("M_Name");
String Director = request.getParameter("Director");
String Actor = request.getParameter("Actor");
String Information = request.getParameter("Information");
int Grade = Integer.parseInt(request.getParameter("Grade")); 
String ReservPer = request.getParameter("ReservPer");

Connection con = null;
Statement stmt = null;
String sql;

try {
	Class.forName("com.mysql.jdbc.Driver");
	con = DriverManager.getConnection(jdbcUrl, dbUser, dbPass);
	sql = "update movie set M_Name = '"+M_Name+"', Director = '" +Director+"', Actor = '" + Actor+"', Grade = '"+Grade+"', Information = '"+Information+"', ReservPer = '"+ReservPer+ "' where MovieID = '"+MovieID+"'";
	stmt=con.createStatement();
	
	stmt.executeUpdate(sql);
	
	out.print("<script>");	
	out.print("location.href='movie_manage.jsp';");
	out.print("</script>");
	
} catch (SQLException e) {
	e.printStackTrace();
} finally {

	if(stmt != null)
		try {
			stmt.close();
		} catch (Exception e) {}
	if(con != null)
		try {
			con.close();
		} catch (Exception e) {}
}
%>

</body>
</html>